feat(auth): implement GitHub OAuth to distribute API rate limits across authenticated users - #5744
Conversation
|
@kanishka-2007-tech is attempting to deploy a commit to the jhasourav07's projects Team on Vercel. A member of the Team first needs to authorize it. |
📦 Next.js Bundle Size Report (Gzipped Sizes)
📊 Summary of Totals
|
Aamod007
left a comment
There was a problem hiding this comment.
This is a solid OAuth/token-plumbing change, but it is currently blocked by the Vercel check waiting for team authorization. The status context points to the deploy authorization link, so please get that approved and rerun checks before we can merge. The code paths to recheck after that are auth.ts, lib/githubtoken.ts, and the token wiring in app/(root)/dashboard/[username]/page.tsx, app/(root)/dashboard/org/[orgname]/page.tsx, and app/api/stats/route.ts.
Aamod007
left a comment
There was a problem hiding this comment.
This OAuth/token plumbing is cohesive and the test/utility updates line up with the new auth flow. The changes in auth.ts, lib/githubtoken.ts, lib/github.ts, and the dashboard/API callers are consistent, so I’m happy to approve this now.
|
@Aamod007 I think this PR deserves the label : critical . 😃 |
my bad |
|
🎉 Congratulations @kanishka-2007-tech! Your PR has been successfully merged. 🚀 Thank you for contributing to CommitPulse. Your work helps us build a better tool for the community.
Keep building! 💻✨ |
…ts across authenticated users (JhaSourav07#5744) ## Description This PR introduces GitHub OAuth authentication to reduce dependency on the application's global Personal Access Token (PAT) and prevent rate-limit exhaustion under high traffic. Authenticated users can now sign in with GitHub, allowing dashboard-related GitHub API requests to be performed using their personal OAuth access token. The existing server PAT is retained as a fallback for unauthenticated users and README SVG generation endpoints. ## Solution Implemented GitHub OAuth authentication using NextAuth. - Authentication Flow - Added Sign in with GitHub functionality. - Users can authenticate via GitHub OAuth. - GitHub access tokens are stored securely in the session/JWT. - Dashboard requests automatically use the authenticated user's token. - Unauthenticated requests continue using the server PAT as a fallback. Fixes JhaSourav07#3679 ## Pillar - [x] 🎨 Pillar 1 — New Theme Design - [x] 📐 Pillar 2 — Geometric SVG Improvement - [x] 🛠️ Other (Bug fix, refactoring, docs) ## Checklist before requesting a review: - [x] I have read the `CONTRIBUTING.md` file. - [x] I have tested these changes locally (`localhost:3000/api/streak?user=YOUR_USERNAME`). - [x] I have run `npm run format` and `npm run lint` locally and resolved all errors (CI will fail otherwise). - [x] My commits follow the Conventional Commits format (e.g., `feat(themes): ...`, `fix(calculate): ...`). - [x] I have updated `README.md` if I added a new theme or URL parameter. - [x] I have started the repo. - [ ] I have made sure that i have only one commit to merge in this PR. - [x] The SVG output matches the CommitPulse "premium quality" aesthetic standard (no raw elements, smooth animations, correct fonts). - [x] (Recommended) I joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.
Description
This PR introduces GitHub OAuth authentication to reduce dependency on the application's global Personal Access Token (PAT) and prevent rate-limit exhaustion under high traffic.
Authenticated users can now sign in with GitHub, allowing dashboard-related GitHub API requests to be performed using their personal OAuth access token. The existing server PAT is retained as a fallback for unauthenticated users and README SVG generation endpoints.
Solution
Implemented GitHub OAuth authentication using NextAuth.
Fixes #3679
Pillar
Checklist before requesting a review:
CONTRIBUTING.mdfile.localhost:3000/api/streak?user=YOUR_USERNAME).npm run formatandnpm run lintlocally and resolved all errors (CI will fail otherwise).feat(themes): ...,fix(calculate): ...).README.mdif I added a new theme or URL parameter.